package com.thoughtworks.merchantsguide.validator;

/**
 * Validation class to validate roman-numbers.
 *
 */
public class RomanNumberValidator {

	private String REG_EXP_FOR_ROMAN_NUM = "^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$";

	/**
	 * Checks if the roman number is valid or not.
	 * 
	 * @param iRomanNumber
	 * @return
	 */
	public boolean isValidRomanNumber(String iRomanNumber) {

		if (null != iRomanNumber && iRomanNumber.matches(REG_EXP_FOR_ROMAN_NUM)) {
			return true;
		}
		return false;
	}
}